package com.trg.generaltool.util.async;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * ClassName: AsyncTest
 * Description:
 * date: 2021-03-24 16:13
 *
 * @author tangrg
 * @since JDK 1.8
 */
@Component
@Slf4j
public class AsyncTest {

    @Async
    public void async() {
        try {
            Thread.sleep(5000);
            log.info(Thread.currentThread().getName() + "我是异步调用的方法；");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
